package c.h.a.m0.p;

import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/* compiled from: ThreadUtils */
public class a {
    public static Handler a = new Handler(Looper.getMainLooper());
    public static final ThreadFactory b;
    public static final ThreadPoolExecutor c;

    /* compiled from: ThreadUtils */
    public static class a implements ThreadFactory {
        public final AtomicInteger a = new AtomicInteger(1);

        public Thread newThread(Runnable runnable) {
            StringBuilder g = c.b.a.a.a.g("DI_ThreadPool-");
            g.append(this.a.getAndIncrement());
            Thread thread = new Thread(runnable, g.toString());
            thread.setPriority(4);
            return thread;
        }
    }

    static {
        a aVar = new a();
        b = aVar;
        c = new ThreadPoolExecutor(2, 10, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(2), aVar);
    }

    public static void a(Runnable runnable) {
        new Thread(runnable).start();
    }

    public static void b(Runnable runnable) {
        if (Looper.myLooper() == Looper.getMainLooper()) {
            runnable.run();
        } else {
            a.post(runnable);
        }
    }
}
